package com.cg.cgms.service.impl;


import com.cg.cgms.mapper.UserMapper;
import com.cg.cgms.pojo.User;
import com.cg.cgms.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User fidByOpenid(String openid) {
        User u=userMapper.FindByOpenid(openid);
        return u;
    }

    @Override
    public void insert(String openid) {
        userMapper.add(openid);
    }

    @Override
    public void addCollect(String openid, Integer ssid) {
        userMapper.addCollect(openid,ssid);
    }

    @Override
    public boolean find(String openid, Integer ssid) {
        if(userMapper.findlove(openid,ssid)==null){
            return true;
        }
        return false;
    }

    @Override
    public ArrayList<Integer> find(String openid) {
        return userMapper.ssidByOpenid(openid);
    }

    @Override
    public void deleteCollect(String openid, Integer ssid) {
        userMapper.deleteCollect(openid,ssid);
    }


}
